/**
 * 模态框
 */
module.exports = function ($scope, $state, $stateParams, $modalInstance, items, $http) {


	$scope.obj = {};
	$scope.obj = items;
	$scope.obj.company_code = items.seller_code;
	$scope.obj.balance_price = 0;
	$scope.balance;


	$http({
		url: '/api/as/tc/bmaccount/getSellerInfoByCode',
		method: 'GET',
		params: {}
	}).then(function (resp) {
		//resp是一个响应对象
		console.log(resp.data);
		if (resp.data.errcode === 0) {
			$scope.balance = resp.data.data.balance_price;
		}
		else {
			alert(resp.data.errmsg);
		}
	}, function (resp) {
		//带有错误信息的resp
		alert('处理响应失败');
	});


	$scope.ok = function () {
		console.log($scope.obj);
		var update = $http({
			url: '/api/ac/tc/ticketBmAccountService/updateRechargeBySellerCode',
			method: 'GET',
			params: $scope.obj
		});
		update.then(function (resp) {
			//resp是一个响应对象
			console.log(resp.data);
			if (resp.data.errcode === 0) {
				alert('充值成功');
			}
			else {
				alert(resp.data.errmsg);
			}
		}, function (resp) {
			//带有错误信息的resp
			alert('处理响应失败');
		});

	};
};